package edu.towson.cosc455.JohnCarloSalter.compiler;

import java.util.ArrayList;

public class LexicalTokens {
	
	//STARTER STUFF
	final static String DOC_BEGIN = "#HAI";
	final static String DOC_END = "#KTHXBYE";
	final static String HEAD_BEGIN = "#MAEK HEAD";
	final static String HEAD_END = "#OIC";
	
	//TEH COMMENTZ
	final static String COMMENT_BEGIN = "#OBTW";
	final static String COMMENT_END = "#TLDR"; 
	
	//MAEK STUFF
	final static String PARAGRAPH_BEGIN = "#MAEK PARAGRAF";
	final static String PARAGRAPH_END = "#OIC";
	final static String LIST_BEGIN = "#MAEK LIST";
	final static String LIST_END = "#OIC";
	
	//GIMMEH STUFF
	final static String TITLE_BEGIN = "#GIMMEH TITLE";
	final static String TITLE_END = "#MKAY";
	final static String BOLD_BEGIN = "#GIMMEH BOLD";
	final static String BOLD_END = "#MKAY";
	final static String ITALICS_BEGIN = "#GIMMEH ITALICS";
	final static String ITALICS_END = "#MKAY";
	final static String LIST_ITEM_BEGIN = "#GIMMEH ITEM";
	final static String LIST_ITEM_END = "#MKAY";
	final static String NEWLINE = "#GIMMEH NEWLINE";
	final static String SOUND_BEGIN = "#GIMMEH SOUNDZ";
	final static String SOUND_END = "#MKAY";
	final static String VIDEO_BEGIN = "#GIMMEH VIDZ";
	final static String VIDEO_END = "#MKAY";
	
	//VARIABLE STUFF
	final static String VARIABLE_DEFINE_BEGIN = "#I HAS A";
	final static String VARIABLE_DEFINE_MIDDLE = "#ITZ";
	final static String VARIABLE_DEFINE_END = "#MKAY";
	final static String VARIABLE_USE_BEGIN = "#VISIBLE";
	final static String VARIABLE_USE_END = "#MKAY";
	
	//Whitespace
	final static String SPACE = " ";
	final static String TAB = "\t";
	final static String NL = "\n";
	
	//Returns true if the String s is found in the above list of variables.
	//This method ignores case when comparing s to our above variables.
	public static boolean found(String s) {
		ArrayList<String> legalTokens = new ArrayList<String>();
		legalTokens.add(DOC_BEGIN);
		legalTokens.add(DOC_END);
		legalTokens.add(HEAD_BEGIN);
		legalTokens.add(HEAD_END);
		legalTokens.add(COMMENT_BEGIN);
		legalTokens.add(COMMENT_END);
		legalTokens.add(PARAGRAPH_BEGIN);
		legalTokens.add(PARAGRAPH_END);
		legalTokens.add(LIST_BEGIN);
		legalTokens.add(LIST_END);
		legalTokens.add(TITLE_BEGIN);
		legalTokens.add(TITLE_END);
		legalTokens.add(BOLD_BEGIN);
		legalTokens.add(BOLD_END);
		legalTokens.add(ITALICS_BEGIN);
		legalTokens.add(ITALICS_END);
		legalTokens.add(LIST_ITEM_BEGIN);
		legalTokens.add(LIST_ITEM_END);
		legalTokens.add(NEWLINE);
		legalTokens.add(SOUND_BEGIN);
		legalTokens.add(SOUND_END);
		legalTokens.add(VIDEO_BEGIN);
		legalTokens.add(VIDEO_END);
		legalTokens.add(VARIABLE_DEFINE_BEGIN);
		legalTokens.add(VARIABLE_DEFINE_MIDDLE);
		legalTokens.add(VARIABLE_DEFINE_END);
		legalTokens.add(VARIABLE_USE_BEGIN);
		legalTokens.add(VARIABLE_USE_END);
		legalTokens.add(SPACE);
		legalTokens.add(TAB);
		legalTokens.add(NL);
		
		//List is complete.
		//Check to see if String s is in the list, ignoring case.
		for(int i=0; i<legalTokens.size(); i++) {
			if(s.equalsIgnoreCase(legalTokens.get(i))) {
				return true;
			} //end if
		} //end for
		return false;
		
	}
}
